﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     
                    xmlns:reader="clr-namespace:MishraReader.ViewModels.Reader;assembly=MishraReader.ViewModels"
                    xmlns:mishraReader="clr-namespace:MishraReader;assembly=MishraReader.ViewModels">
    <DataTemplate DataType="{x:Type reader:BookmarkViewModel}">
        <DockPanel Width="430" MaxHeight="300" x:Name="templateRoot" >

                <Grid  DockPanel.Dock="Bottom" Margin="0,20,0,0">
                    <TextBlock HorizontalAlignment="Left"><Hyperlink Command="{Binding SettingsCommand}"><Run Text="{x:Static mishraReader:Strings.ConfigureBookmarkServices}" />
                    </Hyperlink>
                    </TextBlock>


                    <Button Command="{Binding CancelCommand}" Content="{x:Static mishraReader:Strings.Cancel}" HorizontalAlignment="Right" IsCancel="True" Margin="10,0,0,0"/>

                </Grid>



                <ItemsControl  DockPanel.Dock="Top" HorizontalAlignment="Left" Margin="0,0,-20,-20"
                          ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                          ItemsSource="{Binding ActivatedServices}" >
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <WrapPanel />
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                    <ItemsControl.ItemTemplate>
                        <DataTemplate DataType="{x:Type reader:ShareServiceViewModel}">
                            <Button Style="{StaticResource MetroImageButton}" Margin="0,0,20,20" 
                                Command="{Binding DataContext.BookmarkCommand, ElementName=templateRoot}" 
                                CommandParameter="{Binding}">
                                <Grid Width="100" Height="100" Background="{StaticResource MetroTextLight}">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="*" />
                                        <RowDefinition Height="Auto" />
                                    </Grid.RowDefinitions>
                                    <Image Stretch="None" Source="{Binding ServiceLogo}" VerticalAlignment="Center" HorizontalAlignment="Center" />
                                    <Grid Grid.Row="1">
                                        <Rectangle Fill="{DynamicResource MetroAccentBrush}" Grid.Row="1" />
                                    <TextBlock Text="{Binding ServicePackage.ServiceName, FallbackValue=[name]}" Margin="5,6,5,6" HorizontalAlignment="Center" Style="{DynamicResource MetroNormalText}" Foreground="{DynamicResource MetroHeadingColorLight}"/>
                                    </Grid>
                                </Grid>
                            </Button>

                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>

            </DockPanel>
    </DataTemplate>
</ResourceDictionary>